package com.odianyun.hello.web.controller;

import com.odianyun.db.mybatis.QueryParam;
import com.odianyun.hello.mapper.SoPackageMapper;
import com.odianyun.hello.model.DTO.SoPackageDTO;
import com.odianyun.hello.model.PO.SoPO;
import com.odianyun.hello.model.PO.SoPackagePO;
import com.odianyun.hello.service.SoPackageService;
import com.odianyun.project.model.vo.ObjectResult;
import com.odianyun.project.model.vo.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
public class SoPackageController extends AbstractSoPackageController<SoPackageDTO> {


    @Resource
    private SoPackageService soPackageService;

    @ApiOperation("getByNameRegex-模糊查询")
    @PostMapping("getByNameRegex")
    public Result getByNameRegex(String regexName){
        List<SoPackagePO> soPackagePOS = soPackageService.getByNameRegex(regexName);
        return ObjectResult.ok(soPackagePOS);
    }

    @ApiOperation("updateStatusForSignWithTx-包裹签收")
    @PostMapping("updateStatusForSignWithTx")
    public Result updateStatusForSignWithTx(SoPackageDTO dto){
        soPackageService.updateStatusForSignWithTx(dto);
        return Result.OK;
    }


}
